		<?php $this->load->view('layout/lib_chart');?>
		
		<?php 
		//print_r($row);
		$M	=	$row['desired_monthly_income'];
		$year_birth	=	date('Y',strtotime($_SESSION['customer']['date_of_birth']));
		$RA	=	$row['retirement_age'];
		$current_age	=	date('Y') - intval($year_birth);
		$C	=	$RA - $current_age;
		$i	=	$row['inflation']/100;
		//echo $i.'i|';
		$D	=	pow((1+$i),$C)*$M;
		$N	=	$row['number_of_years_to_receive'];
		$YIPV	=	$M*12;
		$year_retirement	=	intval($year_birth)	+	intval($RA);
		//echo $D.'|';
		$Retirement_Fund_RF	=	round($N*12*$D); 
		//echo $Retirement_Fund_RF;
		
		
		//Tinh retirement + current holding
		$current_year	=	date('Y');
		$year_birday	=	date('Y',strtotime($_SESSION['customer']['date_of_birth']));
		$year_retirement	=	$year_birday + ($paramter ? $paramter->retirement_age : 60);
		$cats_re	=	array();
		
		foreach($endowments as $k => $v){
			$year	=	$v->policy_incepted+$v->policy_term;
			$cats_re	=	doi_cho($cats_re,$year);
		}
		
		$cats_re	=	doi_cho($cats_re,$year_retirement);
		foreach($wls as $k => $v){
			$year	=	$v->policy_incepted+$v->policy_term;
			$cats_re	=	doi_cho($cats_re,$year);
		}
		
		foreach($ilps as $k => $v){
			$year	=	$v->policy_incepted+$v->policy_term;
			$cats_re	=	doi_cho($cats_re,$year);
		}
		
		//$cats_re[]=2070;
		$last_year	=	$year_birday	+	100;
		$cats_re[]	=	$last_year;
		
		//print_r($cats_re);
		
		//print_r($cats);
		$data_g	=	array();
		foreach($cats_re as $y){
			//$tmp_ec	=	$this->common_model->get_result_existing_coverage($y);
			//$tmp_ec	=	0;
			$tmp_ec	=	$this->common_model->return_retirement_by_year($y);
			$tmp_ch	=	$this->current_holding_model->return_value_by_year($y);
			//$tmp_ch=0;
			$data_g[]=array(intval($y),$tmp_ec+$tmp_ch);
		}
		
		$data_g	=	json_encode($data_g);
		
		
		?>
		<!-- 2. Add the JavaScript to initialize the chart on document ready -->
		<script type="text/javascript">
		

		var chart1,chart2,chart3,chart4;
		$(document).ready(function() {
			chart1 = new Highcharts.Chart({
				chart: {
					renderTo: 'container1',
					defaultSeriesType: 'spline',
					inverted: false,
					//width: 400,
					style: {
						//margin: '0 auto'
					}
				},
				title: {
					text: '<?php echo 'Retirement';?>'
				},
				subtitle: {
					style: {
						position: 'absolute',
						right: '0px',
						bottom: '10px'
					}
				},
				xAxis: {
					reversed: false,
					title: {
						enabled: true,
						text: 'PI+t'
					},
					labels: {
						formatter: function() {
							return this.value +'';
						}
					},
					maxPadding: 0.05,
					//showLastLabel: true,
					min : <?php echo $current_year;?>,
					max : <?php echo $last_year;?>
				},
				yAxis: {
					title: {
						text: ''
					},
					labels: {
						formatter: function() {
							return this.value + '';
						}
					},
					lineWidth: 2,
					min : 0
					
				},
				legend: {
					enabled: false
				},
				tooltip: {
					formatter: function() {
						return ''+
							this.y +' / '+ this.x +'';
					}
				},
				plotOptions: {
					spline: {
						marker: {
							enable: false
						}
					}
				},
				series: [
				{
					name: 'FB',
					data: [[<?php echo $year_retirement;?>,<?php echo $Retirement_Fund_RF;?>],[<?php echo $last_year;?>,<?php echo $Retirement_Fund_RF;?>]],
					text: 'FB'
				},
				{
					name: '',
					data: <?php echo $data_g;?>
				}
				]
			});
		});
				
		</script>
		<!-- 3. Add the container -->
		<div></div>
		<table>
			<tr>
				<td><div id="container1" style="width: 800px; height: 400px; margin: 0 auto"></div></td>
			</tr>
			
		</table>
		